package com.xxx.dict.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxx.dict.domain.DictItem;
import com.xxx.dict.mapper.DictItemMapper;
import com.xxx.dict.query.DictItemQuery;
import com.xxx.dict.service.IDictItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictItemServiceImpl implements IDictItemService {
    @Autowired
    private DictItemMapper dictItemMapper;
    @Override
    public List<DictItem> findAll() {
        List<DictItem> list = dictItemMapper.findAll();
        return list;
    }

    @Override
    public DictItem findOne(Long id) {
        return dictItemMapper.findOne(id);
    }

    @Override
    public List<DictItem> findByPage(DictItemQuery dictItemQuery,Long id) {
        PageHelper.startPage(dictItemQuery.getCurrentPage(), dictItemQuery.getPageSize());
        return dictItemMapper.findByPage(dictItemQuery,id);
    }

    @Override
    public void updateById(DictItem dictItem) {
        dictItemMapper.updateById(dictItem);
    }

    @Override
    public void insert(DictItem dictItem) {

        dictItemMapper.insert(dictItem);

    }

    @Override
    public void deleteById(Long id) {
        dictItemMapper.deleteById(id);
    }

    @Override
    public void bathDictItems(Long[] ids) {
        dictItemMapper.bathDictItems(ids);
    }
}
